package tech.aistar.util;
import com.github.qcloudsms.SmsSingleSender;
import com.github.qcloudsms.SmsSingleSenderResult;
import com.github.qcloudsms.httpclient.HTTPException;
import org.json.JSONException;
import java.io.IOException;
public class SmsModel {
    private static int appid = 1400112426;
    private static String appkey="e8100999c3d47a649e25ce678202825e";
    private static String smsSign="两人随纪";

    public static  void sendSms(String phone,int templateId ,String params){

        try {
            String[] paramss = {params};

            SmsSingleSender ssender = new SmsSingleSender(appid, appkey);
            SmsSingleSenderResult result = ssender.sendWithParam("86", phone,
                    templateId, paramss, smsSign, "", "");
            System.out.println(result+"result");
        } catch (HTTPException e) {
            // HTTP 响应码错误
            e.printStackTrace();
        } catch (JSONException e) {
            // JSON 解析错误
            e.printStackTrace();
        } catch (IOException e) {
            // 网络 IO 错误
            e.printStackTrace();
        }
    }


    public static void main(String[] args) {
        sendSms("18735572024",441557,"106626");

    }
}
